function ccR_DeathKnight_2()
	if ccrPlayerLevel() == 90 then
		if OffhandHasWeapon() == nil then
			DeathKnight_Frost_2H_90()
		else
			DeathKnight_Frost_DW_90()
		end;
	end
end

function DeathKnight_Frost_2H_90()
	--[[
		Patch: 5.3 2H
		Source: Noxxic (http://www.noxxic.com/wow/pve/death-knight/frost/dps-rotation-and-cooldowns)
		Talents: 
					[56] Plague Leech
					[57] Anti-Magic Zone
					[58] Death's Advance
					[60] Death Pact
					[75] Runic Empowerment
					[90] Gorefiend's Grasp
		Priority:
			- Single Target -
			1. Frost Fever Blood Plague Maintain at all times.
			2. Soul Reaper on target below 35% Health.
			3. Howling Blast with Rime(Freezing Fog) or to refresh Frost Fever
			4. Obliterate with Killing Machine.
			5. Frost Strike with 0 Frost Runes or to dump RP.
			6. Obliterate with 2 Blood, Frost, or Unholy Runes.
			- AoE -
			1. Howling Blast
			2. Death and Decay

	]]--
	-- Functions.lua
	ccR_DeathKnight_DeathStrike()
	ccR_DeathKnight_PillarOfFrost()
	ccR_DeathKnight_RaiseDead()
	-- Talents.lua
	ccR_DeathKnight_RoilingBlood()
	ccR_DeathKnight_PlagueLeech()
	ccR_DeathKnight_UnholyBlight()
	ccR_DeathKnight_LichborneHealing()
	ccR_DeathKnight_AntiMagicZone()
	ccR_DeathKnight_Deaths_Advance()
	ccR_DeathKnight_Asphyxiate()
	ccR_DeathKnight_Death_Pact()
	ccR_DeathKnight_DeathSiphon()
	ccR_DeathKnight_Conversion()
	ccR_DeathKnight_BloodTap()
	ccR_DeathKnight_GorefiendsGrasp()
	ccR_DeathKnight_RemorselessWinter()
	-- Abilities.lua
	ccR_DeathKnight_MindFreeze()
	ccR_DeathKnight_Strangulate()
	ccR_DeathKnight_ChainsOfIce()
	ccR_DeathKnight_Dark_Simulacrum()
	ccR_DeathKnight_Empower_Rune_Weapon()
	ccR_DeathKnight_Horn_of_Winter()
	ccR_DeathKnight_Icebound_Fortitude()

	-- Single target rotation
	local vTargetCount = ccrTargetCount(10)
	if (ccRS.Auto_AoE and (vTargetCount >= 1 and vTargetCount <= ccRS.DeathKnight_2_SingleTargetCount))
	or (ccrTargetIsBoss() and ccRS.Auto_AoE_Ignore_On_Boss)
	or (not ccRS.Auto_AoE and not ccRS.Manual_AoE)	
	then
		-- 1. Apply Diseases
		if ccrSpellCanAttack(OUTBREAK)
		and (
			(not ccrTargetHasMyDebuff(FROST_FEVER) or not ccrTargetHasMyDebuff(BLOOD_PLAGUE))
		or
			(ccrTargetHasMyDebuffRemaining(FROST_FEVER, 3) or ccrTargetHasMyDebuffRemaining(BLOOD_PLAGUE, 3))
			)
		then
			ccrCastAttack(OUTBREAK)
			return
		else
			-- Frost Fever [Howling Blast]
			if not ccrTargetHasMyDebuff(FROST_FEVER)
			and ccrSpellCanAttack(HOWLING_BLAST)
			then
				ccrCastAttack(HOWLING_BLAST)
				return
			else
				-- Blood Plague [Plague Strike]
				if not ccrTargetHasMyDebuff(BLOOD_PLAGUE)
				and ccrSpellCanAttack(PLAGUE_STRIKE)
				then
					ccrCastAttack(PLAGUE_STRIKE)
					return
				end
			end
		end;
		-- 2. Soul Reaper on target below 35% Health.
		if ccrTargetHealth() <= 35
		and ccrSpellCanAttack(SOUL_REAPER)
		then
			ccrCastAttack(SOUL_REAPER)
			return
		end
		-- Diseases are on the target
		if ccrTargetHasMyDebuff(FROST_FEVER) and ccrTargetHasMyDebuff(BLOOD_PLAGUE) then
			-- 3. Howling Blast with Rime(Freezing Fog) or to refresh Frost Fever
			if ccrPlayerRunicPower() <= 85
			and (ccrPlayerHasBuff(FREEZING_FOG) or ccrTargetHasMyDebuffRemaining(FROST_FEVER, 4))
			and ccrSpellCanAttack(HOWLING_BLAST)
			then
				ccrCastAttack(HOWLING_BLAST)
				return
			else
				-- 4 Obliterate with Killing Machine.
				if ccrPlayerHasBuff(KILLING_MACHINE)
				and ccrSpellCanAttack(OBLITERATE)
				then
					ccrCastAttack(OBLITERATE)
					return
				else
					-- 5. Frost Strike with 0 Frost Runes or to dump RP.
					local vRuneA_Start, vRuneA_Duration, vRuneA_RuneReady = GetRuneCooldown(5)
					local vRuneB_Start, vRuneB_Duration, vRuneB_RuneReady = GetRuneCooldown(6)
					if ccrSpellCanAttack(FROST_STRIKE)
					and (not vRuneA_RuneReady and not vRuneB_RuneReady)
					then
						ccrCastAttack(FROST_STRIKE)
						return
					else
						-- 6. Obliterate with 2 Blood, Frost, or Unholy Runes.				
						local vRuneA_Start, vRuneA_Duration, vRuneA_RuneReady = GetRuneCooldown(1)
						local vRuneB_Start, vRuneB_Duration, vRuneB_RuneReady = GetRuneCooldown(2)
						local vRuneC_Start, vRuneC_Duration, vRuneC_RuneReady = GetRuneCooldown(3)
						local vRuneD_Start, vRuneD_Duration, vRuneD_RuneReady = GetRuneCooldown(4)
						local vRuneE_Start, vRuneE_Duration, vRuneE_RuneReady = GetRuneCooldown(5)
						local vRuneF_Start, vRuneF_Duration, vRuneF_RuneReady = GetRuneCooldown(6)
						local vRuneReadyCount = 0
						if vRuneA_RuneReady then vRuneReadyCount = vRuneReadyCount + 1 end
						if vRuneB_RuneReady then vRuneReadyCount = vRuneReadyCount + 1 end
						if vRuneC_RuneReady then vRuneReadyCount = vRuneReadyCount + 1 end
						if vRuneD_RuneReady then vRuneReadyCount = vRuneReadyCount + 1 end
						if vRuneE_RuneReady then vRuneReadyCount = vRuneReadyCount + 1 end
						if vRuneF_RuneReady then vRuneReadyCount = vRuneReadyCount + 1 end

						--if (vRuneA_RuneReady and vRuneB_RuneReady)
						--or (vRuneC_RuneReady and vRuneD_RuneReady)
						--or (vRuneE_RuneReady and vRuneF_RuneReady)
						if vRuneReadyCount >= 2
						and ccrSpellCanAttack(OBLITERATE)
						then
							ccrCastAttack(OBLITERATE)
							return
						else
							if ccrSpellCanAttack(FROST_STRIKE) then ccrCastAttack(FROST_STRIKE) end
						end
					end						
				end
			end
		end
	end
	-- AoE Rotation
	if (ccRS.Auto_AoE and vTargetCount >= ccRS.DeathKnight_2_AoECount)
	or (not ccRS.Auto_AoE and ccRS.Manual_AoE)
	then
		-- Ensure we dont cap runic power
		if ccrSpellCanAttack(FROST_STRIKE)
		and (ccrPlayerRunicPower() >= 75 or ccrPlayerHasBuff(KILLING_MACHINE))
		then
			ccrCastAttack(FROST_STRIKE)
			return
		else			
			-- Death and Decay
			local vRuneA_Start, vRuneA_Duration, vRuneA_RuneReady = GetRuneCooldown(5)
			local vRuneB_Start, vRuneB_Duration, vRuneB_RuneReady = GetRuneCooldown(6)

			if ccrSpellIsReady(DEATH_AND_DECAY) 
			and not vRuneA_RuneReady
			and not vRuneB_RuneReady
			then
				ccrCast(DEATH_AND_DECAY)
				if SpellIsTargeting() == 1 then CastAtLocation(Target:GetLocation()) end;			
			else
				-- Howling Blast
				if ccrSpellCanAttack(HOWLING_BLAST) then ccrCastAttack(HOWLING_BLAST) end;
				-- Ensure Blood Plague is applied for Rolling Blood
				if ccrPlayerHasTalent(ROILING_BLOOD)
				and not ccrTargetHasMyDebuff(BLOOD_PLAGUE)
				and (ccrSpellCanAttack(OUTBREAK) or ccrSpellCanAttack(PLAGUE_STRIKE))
				then
					if SpellCanAttack(OUTBREAK) then ccrCastAttack(OUTBREAK) end;
					if SpellCanAttack(PLAGUE_STRIKE) then ccrCastAttack(PLAGUE_STRIKE) end;
				end					
			end				
		end
	end
end

function DeathKnight_Frost_DW_90()
	--[[
		Patch: 5.4.7 DW
		Source: Noxxic (http://www.noxxic.com/wow/pve/death-knight/frost/dps-rotation-and-cooldowns)
	]]--	
	-- Functions.lua
	ccR_DeathKnight_DeathStrike()
	ccR_DeathKnight_PillarOfFrost()
	ccR_DeathKnight_RaiseDead()
	-- Talents.lua
	ccR_DeathKnight_RoilingBlood()
	ccR_DeathKnight_PlagueLeech()
	ccR_DeathKnight_UnholyBlight()
	ccR_DeathKnight_LichborneHealing()
	ccR_DeathKnight_AntiMagicZone()
	ccR_DeathKnight_Deaths_Advance()
	ccR_DeathKnight_Asphyxiate()
	ccR_DeathKnight_Death_Pact()
	ccR_DeathKnight_DeathSiphon()
	ccR_DeathKnight_Conversion()
	ccR_DeathKnight_BloodTap()
	ccR_DeathKnight_GorefiendsGrasp()
	ccR_DeathKnight_RemorselessWinter()
	-- Abilities.lua
	ccR_DeathKnight_MindFreeze()
	ccR_DeathKnight_Strangulate()
	ccR_DeathKnight_ChainsOfIce()
	ccR_DeathKnight_Dark_Simulacrum()
	ccR_DeathKnight_Empower_Rune_Weapon()
	ccR_DeathKnight_Horn_of_Winter()
	ccR_DeathKnight_Icebound_Fortitude()

	-- Single target rotation
	local vTargetCount = ccrTargetCount(10)
	if (ccRS.Auto_AoE and (vTargetCount >= 1 and vTargetCount <= ccRS.DeathKnight_2_SingleTargetCount))
	or (ccrTargetIsBoss() and ccRS.Auto_AoE_Ignore_On_Boss)
	or (not ccRS.Auto_AoE and not ccRS.Manual_AoE)	
	then	
		-- 1. Apply Diseases
		if ccrSpellCanAttack(OUTBREAK)
		and (
			(not ccrTargetHasMyDebuff(FROST_FEVER) or not ccrTargetMyHasDebuff(BLOOD_PLAGUE))
		or
			(ccrTargetHasMyDebuffRemaining(FROST_FEVER, 3) or ccrTargetHasMyDebuffRemaining(BLOOD_PLAGUE, 3))
			)
		then
			ccrCastAttack(OUTBREAK)
			return
		else
			-- Frost Fever [Howling Blast]
			if not ccrTargetHasMyDebuff(FROST_FEVER)
			and ccrSpellCanAttack(HOWLING_BLAST)
			then
				ccrCastAttack(HOWLING_BLAST)
				return
			else
				-- Blood Plague [Plague Strike]
				if not ccrTargetHasMyDebuff(BLOOD_PLAGUE)
				and SpellCanAttack(PLAGUE_STRIKE)
				then
					ccrCastAttack(PLAGUE_STRIKE)
					return
				end
			end
		end;
		-- 3. Soul Reaper on target below 35% Health.
		if ccrTargetHealth() <= 35
		and ccrSpellCanAttack(SOUL_REAPER)
		then
			ccrCastAttack(SOUL_REAPER)
			return
		end
		-- 1. Diseases are on the target
		if ccrTargetHasMyDebuff(FROST_FEVER) and ccrTargetHasMyDebuff(BLOOD_PLAGUE) then
			-- 2 Frost Strike with Killing Machine or if RP will cap
			if SpellCanAttack(FROST_STRIKE)
			and (ccrPlayerHasBuff(KILLING_MACHINE) or ccrPlayerRunicPower() >= 85)
			then
				-- Use on Killing Machine
				ccrCastAttack(FROST_STRIKE)
				return
			else
				-- 4. Howling Blast with Rime(Freezing Fog) or to refresh Frost Fever
				if ccrPlayerRunicPower() <= 85
				and (ccrPlayerHasBuff(FREEZING_FOG) or ccrTargetHasMyDebuffRemaining(FROST_FEVER, 4))
				and ccrSpellCanAttack(HOWLING_BLAST)
				then
					ccrCastAttack(HOWLING_BLAST)
					return
				else
					-- 5. Obliterate with >= 1 Unholy Runes
					local vRuneA_Start, vRuneA_Duration, vRuneA_RuneReady = GetRuneCooldown(3)
					local vRuneB_Start, vRuneB_Duration, vRuneB_RuneReady = GetRuneCooldown(4)
					if ccrSpellCanAttack(OBLITERATE)
					and (vRuneA_RuneReady or vRuneB_RuneReady)
					then
						ccrCastAttack(OBLITERATE)
						return
					else
						-- 6. Howling Blast to dump Frost and Unholy runes.			
						if SpellCanAttack(HOWLING_BLAST) then
							ccrCastAttack(HOWLING_BLAST)
							return
						else
							-- 7. Use Frost Strike to dump RP
							if SpellCanAttack(FROST_STRIKE) then
								ccrCastAttack(FROST_STRIKE)
								return
							end
						end
					end
				end
			end
		end
		return
	end
	-- AoE Rotation
	-- if vTargetCount >= ccrAoERotationCount() then
	if (ccRS.Auto_AoE and vTargetCount >= ccRS.DeathKnight_2_AoECount)
	or (not ccRS.Auto_AoE and ccRS.Manual_AoE)
	then
		-- Ensure we dont cap runic power
		if ccrSpellCanAttack(FROST_STRIKE)
		and (ccrPlayerRunicPower() >= 75 or ccrPlayerHasBuff(KILLING_MACHINE))
		then
			ccrCastAttack(FROST_STRIKE)
			return
		else			
			-- Howling Blast
			if ccrSpellCanAttack(HOWLING_BLAST) then
				ccrCastAttack(HOWLING_BLAST) 
				return
			else
				-- Death and Decay
				if ccrSpellIsReady(DEATH_AND_DECAY) then
					ccrCast(DEATH_AND_DECAY)
					if SpellIsTargeting() == 1 then	CastAtLocation(Target:GetLocation()) end;			
				else
					-- Plague strike if D&D on cd and any unholy rune available.
					local vRuneA_Start, vRuneA_Duration, vRuneA_RuneReady = GetRuneCooldown(3)
					local vRuneB_Start, vRuneB_Duration, vRuneB_RuneReady = GetRuneCooldown(4)
					if ccrSpellCanAttack(PLAGUE_STRIKE)
					and (vRuneA_RuneReady or vRuneB_RuneReady)
					then
						ccrCastAttack(PLAGUE_STRIKE)
						return
					end
					-- Ensure Blood Plague is applied for Rolling Blood
					if ccrPlayerHasTalent(ROILING_BLOOD)
					and (not ccrTargetHasMyDebuff(BLOOD_PLAGUE) or not ccrTargetHasMyDebuff(FROST_FEVER))
					and (ccrSpellCanAttack(OUTBREAK) or ccrSpellCanAttack(PLAGUE_STRIKE))
					then
						if ccrSpellCanAttack(OUTBREAK) then ccrCastAttack(OUTBREAK) end;
					end
				end
			end
		end
	end
end
